home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Games: Greatest Hits 1996
/
Amiga Games: Greatest Hits 1996.iso
/
archive
/
userbox
/
publicdomain
/
xfd.lha
/
xfd
/
Developper
/
AmigaE
/
EPrograms
/
xfdtextview.e
< prev
Wrap
Text File
|
1996-08-03
|
2KB
|
64 lines
-> show a textfile in a nice juicy scrolling window
-> NEW from DII: XFD support added 12/4/96
MODULE 'tools/file', 'tools/exceptions', 'class/sctext',
'xfdmaster','libraries/xfdmaster','exec/memory'
DEF xfdmasterbase
PROC main() HANDLE
DEF m,l,n,list,sc=NIL:PTR TO scrolltext,
bufinf=NIL:PTR TO xfdbufferinfo,cruncher,ttl[60]:STRING,succ=FALSE
openxfd()
bufinf:=XfdAllocObject(XFDOBJ_BUFFERINFO)
IF bufinf
m,l:=readfile(arg)
cruncher:='ASCII'
bufinf.sourcebuffer:=m
bufinf.sourcebuflen:=l
IF XfdRecogBuffer(bufinf)
IF bufinf.packerflags AND (XFDPFF_PASSWORD OR XFDPFF_KEY16 OR XFDPFF_KEY32)
WriteF('Unsupported. Requires password or key.\n')
Raise("p/k")
ENDIF
bufinf.targetbufmemtype:=MEMF_PUBLIC
IF XfdDecrunchBuffer(bufinf)
l:=bufinf.targetbufsavelen
m:=bufinf.targetbuffer
cruncher:=bufinf.packername
succ:=TRUE
ELSE
WriteF('Failed to decrunch file.\n')
Raise("decr")
ENDIF
ENDIF
list:=stringsinfile(m,l,n:=countstrings(m,l))
NEW sc.settext(list,100)
StringF(ttl,'TextView 1.0 (\s)',cruncher)
sc.open(ttl,20,20,300,150)
WHILE sc.handle()=FALSE DO Wait(-1)
ELSE
WriteF('Couldn''t allocate XFD buffer info.\n')
Raise("MEM")
ENDIF
Raise(0)
EXCEPT DO
IF sc THEN END sc
IF succ THEN FreeMem(bufinf.targetbuffer,bufinf.targetbuflen)
IF bufinf THEN XfdFreeObject(bufinf)
IF xfdmasterbase THEN CloseLibrary(xfdmasterbase)
report_exception()
ENDPROC
PROC openxfd(v=36)
xfdmasterbase:=OpenLibrary('xfdmaster.library',v)
IF xfdmasterbase=NIL
WriteF('Missing "xfdmaster.library" V\d!\n',v)
Raise("xfd")
ENDIF
ENDPROC